package cn.iocoder.yudao.module.pay.splitting.pojo.vo;

import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.pay.splitting.enums.SplittingMerchantStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 *  这里是文件说明
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/05/17
 */
@Data
@Accessors(chain = true)
public class MallBookMerchantVO {

    @Schema(description = "手机号码")
    private String mobile;

    @Schema(description = "状态：0-待处理、1-注册成功、2-注册失败", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
    @InEnum(SplittingMerchantStatusEnum.class)
    private Integer status;

    @Schema(description = "渠道注册成功返回的用户编号")
    private String channelUserId;

    @Schema(description = "渠道错误码")
    private String channelErrorCode;

    @Schema(description = "渠道错误消息")
    private String channelErrorMsg;

    @Schema(description = "渠道原始的同步/异步通知结果")
    private Object rawData;

    /**
     * 创建【WAITING】状态的订单返回
     */
    public static MallBookMerchantVO waitingOf(String mobile, Object rawData) {
        MallBookMerchantVO vo = new MallBookMerchantVO();
        vo.mobile = mobile;
        vo.status = SplittingMerchantStatusEnum.WAITING.getStatus();
        vo.rawData = rawData;
        return vo;
    }

    /**
     * 创建【SUCCESS】状态的订单返回
     */
    public static MallBookMerchantVO successOf(String mobile, String channelUserId, Object rawData) {
        MallBookMerchantVO vo = new MallBookMerchantVO();
        vo.mobile = mobile;
        vo.status = SplittingMerchantStatusEnum.SUCCESS.getStatus();
        vo.channelUserId = channelUserId;
        vo.rawData = rawData;
        return vo;
    }

    /**
     * 创建【FAILURE】状态的订单返回
     */
    public static MallBookMerchantVO failureOf(String mobile, String errorCode, String errorMsg, Object rawData) {
        MallBookMerchantVO vo = new MallBookMerchantVO();
        vo.mobile = mobile;
        vo.status = SplittingMerchantStatusEnum.FAILURE.getStatus();
        vo.channelErrorCode = errorCode;
        vo.channelErrorMsg = errorMsg;
        vo.rawData = rawData;
        return vo;
    }

}
